<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <%@include file="/include/meta.jsp"%>
    <base href="<%=basePath%>">
	<title>用户理员</title>
	<link rel="stylesheet" type="text/css" href="css/default.css" />
	<link rel="stylesheet" type="text/css" href="js/jquery.validity.1.2.0/jquery.validity.css" />
	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="js/jquery.validity.1.2.0/jQuery.validity.min.js"></script>
		
	<script type="text/javascript">
		$(function(){
			$("form").validity(function() {
				$("#account").require("帐号必须输入");
				$("#name").require("昵称必须输入");
                $("#password").require("密码必须提供").assert($("#password").val()==$("#passwordAgain").val(),"两次密码输入不一致");
	        	$("#email").require("必须提供Email").match("email","必须为Email数据");
	        });
		});
		
		function checkAccount(){
			var name=$("#account").val();
			if(name==''){
				alert("请先录入帐号");
				return;
			}
			$.ajax({
				url: 'register!checkAccountAvailable.action?loginName='+name,
				success: function(data) {
					if(data=='1'){
					   $("#accountStateTip").html("帐号可用");
				   	}else{
				   		$("#accountStateTip").html("帐号不可用");
				   	}
				}
			});
		}
	</script>
</head>
<body>
	<form action="register!add.action" method="post">
		<table style="width:98%">
			<tr>
				<th style="width:50px">帐号</th>
				<td colspan="3">
					<input type="text" id="account" name="account.account">
					<a href="javascript:;" onclick="checkAccount();">帐号检查</a>
					<label id="accountStateTip"></label>
				</td>
			</tr>
			<tr>
				<th>密码</th>
				<td>
					<input type="password" id="password" name="account.password">
				</td>
				<th>密码确认</th>
				<td>
					<input type="password" id="passwordAgain">
					<label id="passwordTip" style="display:none">两次密码输入不一致</label>
				</td>
			</tr>
			<tr>
				<th>昵称</th>
				<td>
					<input type="text" id="name" name="account.name">
				</td>
				<th>性别</th>
				<td>
					<select name="account.male">
						<option value="true">男</option>
						<option value="false">女</option>
					</select>
				</td>
			</tr>
			<tr>
				<th style="width:50px">Email</th>
				<td colspan="3"><input type="text" id="email" name="account.email"></td>
			</tr>
			<tr>
				<td colspan="4" style="text-align: center;">
					<input type="submit" value="提交">
				</td>
			</tr>
		</table>
   	</form>
</body>
</html>